
from __future__ import absolute_import
from __future__ import print_function
#from __future__ import unicode_literals
from __future__ import division

from pycopia import autodebug


from pelib.persistence.backends.rawfile import RAWFile
from pelib.ruletable import RuleTable


#Generate a simple RuleTable and store
def generateSimpleRuleTable():
    return RuleTable("myTable", None, "RegexParser", "RAWFile", False, False)

myTable = generateSimpleRuleTable()

#Testing with the driver directly
RAWFile.save(myTable,  "RegexParser", fileName="/tmp/myTable.dat")

myTable2 = RAWFile.load("myTable", None, None, fileName="/tmp/myTable.dat")


print ("Objects equal:"+str(myTable==myTable2))
print ("Objects equal:"+str(myTable==myTable2))
print (myTable.uuid)
print (myTable2.uuid)
print (myTable.name)
print (myTable2.name)
print (myTable._persist)
print (myTable2._persist)
print (myTable._parser)
print (myTable2._parser)
print (myTable._persistenceBackend)
print (myTable2._persistenceBackend)
print (myTable._persistenceBackendParameters)
print (myTable2._persistenceBackendParameters)
print (myTable._policy)
print (myTable2._policy)
print (myTable._ruleSet)
print (myTable2._ruleSet)
print (myTable._mappings)
print (myTable2._mappings)
print (myTable._mutex)
print (myTable2._mutex)
print (myTable._resolver)
print (myTable2._resolver)

